package com.java.comprehensive.design.behavioral_model.visitor_pattern;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author 窦绍飞
 * @create 2023/3/2
 * 对象结构类
 */
public class Home {

	// 存储元素对象
	private List<Animal> animals = new ArrayList<Animal>();

	void add(Animal animal) {
		animals.add(animal);
	}

	void action(Person p) {
		for (Animal animal : animals) {
			animal.accept(p);
		}
	}
}
